<?php

/**
 * @author shuang
 * @date 2017-5-30 10:58:38
 */
use common\components\MTools;
?>
<?php if($sliderData):?>
<div id="slider" class="mui-slider" style="height:145px;">
    <div class="mui-slider-group mui-slider-loop">
        <!-- 额外增加的一个节点(循环轮播：第一个节点是最后一张轮播) -->
        <div class="mui-slider-item mui-slider-item-duplicate">
            <a href="<?php echo $sliderData[count($sliderData) - 1]["url"]; ?>">
                <img src="<?php echo MTools::getWebPath($sliderData[count($sliderData) - 1]["image"]); ?>" width="400" height="300">
            </a>
        </div>
        <?php foreach ($sliderData as $item): ?>
            <div class="mui-slider-item">
                <a href="<?php echo $item["url"]; ?>">
                    <img src="<?php echo MTools::getWebPath($item["image"]); ?>" width="400" height="300">
                </a>
            </div>
        <?php endforeach; ?>
        <!-- 额外增加的一个节点(循环轮播：最后一个节点是第一张轮播) -->
        <div class="mui-slider-item mui-slider-item-duplicate">
            <a href="<?php echo $sliderData[0]["url"]; ?>">
                <img src="<?php echo MTools::getWebPath($sliderData[0]["image"]); ?>" width="400" height="300">
            </a>
        </div>
    </div>
    <div class="mui-slider-indicator">
        <?php for ($i = 0; $i < count($sliderData); $i++): ?>
            <div class="mui-indicator <?php echo $i == 0 ? "mui-active" : null; ?>"></div>
        <?php endfor; ?>
    </div>
</div>
<?php endif;?>